import { useAxios } from '@/hooks/web/useAxios'

const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 角色列表
export const roleListApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleList',
      data: data
    }
  })
}

// 角色修改
export const roleEditApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleEdit',
      data: data
    }
  })
}

// 角色新增
export const roleAddApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleAdd',
      data: data
    }
  })
}

// 角色删除
export const roleDelApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleDel',
      data: data
    }
  })
}

// 角色批量删除
export const roleBatchDelApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleBatchDel',
      data: data
    }
  })
}

// 角色菜单权限编辑
export const roleMenuEditApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleMenuEdit',
      data: data
    }
  })
}

// 角色菜单权限查看
export const roleMenuSeeApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleMenuSee',
      data: data
    }
  })
}

// 角色功能权限编辑
export const roleFaEditApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleFaEdit',
      data: data
    }
  })
}

// 角色功能权限查看
export const roleFaSeeApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleFaSee',
      data: data
    }
  })
}

// 角色数据权限编辑
export const roleDaEditApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleDaEdit',
      data: data
    }
  })
}

// 角色数据权限查看
export const roleDaSeeApi = (data: any) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminRoleDaSee',
      data: data
    }
  })
}
